unit UDMConexoes;

interface

uses
  SysUtils, Classes, DB, IBCustomDataSet, IBDatabase, IBQuery, IBTable,
  DBClient, DBLocal, DBLocalI, Provider,  Dialogs, StdCtrls, ComCtrls, IniFiles,
  Windows, Messages,  Variants,  Graphics, Controls, Forms;

type
  TDMConexoes = class(TDataModule)
    BDDados: TIBDatabase;
    IBTransactionDados: TIBTransaction;
    IBQueryGetNextID: TIBQuery;
    procedure DataModuleCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  DMConexoes: TDMConexoes;

implementation

{$R *.dfm}

procedure TDMConexoes.DataModuleCreate(Sender: TObject);
var
  v_caminho : String;
  config: TIniFile;
begin
  config := TIniFile.create(ExtractFilePath(Application.Exename) + '\caminho.ini');
  v_caminho := config.ReadString('caminhos','BDBMSSIG','');
  if (v_caminho = '') then
  begin
    v_caminho := ExtractFilePath(Application.ExeName);
    BDDados.DatabaseName :=  v_caminho + 'bd\BMSSIG.GDB';
    BDDados.Connected := True;
  end
  else
  begin
    BDDados.DatabaseName :=  v_caminho + 'BMSSIG.GDB';
    BDDados.Connected := True;
  end;

end;

end.
